package com.sugar.subscribe.course.module.business.controller.app.coachwallet.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

import static com.sugar.subscribe.course.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;

@Schema(description = "APP - 教练钱包收益 Response VO")
@Data
public class AppCoachProfitHistoryRespVO {

    @Schema(description = "日期", requiredMode = Schema.RequiredMode.REQUIRED)
    private String date;

    @Schema(description = "当前日期下的数据", requiredMode = Schema.RequiredMode.REQUIRED)
    private List<DateData> dataList;

    @Data
    public static class DateData {

        @Schema(description = "用户头像", requiredMode = Schema.RequiredMode.REQUIRED)
        private String userAvatar;

        @Schema(description = "用户手机号", requiredMode = Schema.RequiredMode.REQUIRED)
        private String userMobile;

        @Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED)
        private String orderNo;

        @Schema(description = "订单服务分类名称（二级）", requiredMode = Schema.RequiredMode.REQUIRED)
        private String serviceName;

        @Schema(description = "预估收益", requiredMode = Schema.RequiredMode.REQUIRED)
        private BigDecimal profitAmount;

        @Schema(description = "下单时间", requiredMode = Schema.RequiredMode.REQUIRED)
        @JsonSerialize(using = LocalDateTimeSerializer.class) // 序列化（响应）
        @JsonDeserialize(using = LocalDateTimeDeserializer.class) // 反序列化（请求）
        @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
        private LocalDateTime orderTime;

        @Schema(description = "教练上课时间")
        @JsonSerialize(using = LocalDateTimeSerializer.class) // 序列化（响应）
        @JsonDeserialize(using = LocalDateTimeDeserializer.class) // 反序列化（请求）
        @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
        private LocalDateTime attendClassTime;

        @Schema(description = "收益实际到账时间", requiredMode = Schema.RequiredMode.REQUIRED)
        @JsonSerialize(using = LocalDateTimeSerializer.class) // 序列化（响应）
        @JsonDeserialize(using = LocalDateTimeDeserializer.class) // 反序列化（请求）
        @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
        private LocalDateTime profitArrivalTime;
    }
}
